﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//New and needed
using IM.Common.Message;
using IM.Domain.TransManager;
using IM.Domain.AppServices;
using IM.Domain.Repository;

namespace IM.Domain.Services
{
    public class ServiceBase
    {
        protected TResult ExecuteCommand<TResult>(Func<IRepositoryLocator, TResult> command) where TResult : class, IResponseEnvelopDTO
        {
            using (ITransManager manager = ServiceLocator.Instance().TransFactory.CreateManager())
            {
                return manager.ExecuteCommand(command);
            }
        }
    }
}
